package com.itheima.health.config;

import com.itheima.health.properties.AliSendProperties;

import com.itheima.health.util.AliyunSmsUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class SmsConfiguration {

    @Bean
    public AliyunSmsUtils aliyunSmsUtils(AliSendProperties aliSendProperties) {
        log.info("开始发送短信工具类的创建");
        AliyunSmsUtils aliyunSmsUtils = new AliyunSmsUtils(
                aliSendProperties.getAccessKeyId(),
                aliSendProperties.getAccessKeySecret(),
                aliSendProperties.getSignName(),
                aliSendProperties.getTemplateCode()
        );
        return aliyunSmsUtils;
    }
}